package leetcode_2501_2600;

public class LeeCode_2550 {
    public static void main(String[] args) {
        System.out.println(monkeyMove(1000000));
    }
    private static int monkeyMove(int n) {
        long mod = 1000_000_007;
        long l = get(n, mod);
        return (int) ((l + mod - 2) % mod);
    }
    private static long get(int n, long mod){
        if (n == 1)
            return 2;
        long son = get(n / 2, mod);
        if ((n & 1) == 1){
            return (son * son) % mod * 2 % mod;
        }else {
            return (son * son) % mod;
        }
    }
}
